package com.pearadmin.pro.modules.banner.service.impl;

import java.util.List;
import java.util.ArrayList;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pearadmin.pro.common.web.base.page.PageResponse;
import com.pearadmin.pro.common.web.base.page.Pageable;

import com.pearadmin.pro.modules.banner.domain.ScrmSysBanner;
import com.pearadmin.pro.modules.banner.param.ScrmSysBannerRequest;
import com.pearadmin.pro.modules.banner.repository.ScrmSysBannerRepository;
import com.pearadmin.pro.modules.banner.service.ScrmSysBannerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;


/**
 * banner信息Service业务层处理
 *
 * @author chenJian
 * @date 2021-10-07
 */
@Service
public class ScrmSysBannerServiceImpl extends ServiceImpl<ScrmSysBannerRepository, ScrmSysBanner> implements ScrmSysBannerService
{
    @Resource
    private ScrmSysBannerRepository scrmSysBannerRepository;

    /**
     * 查询banner信息
     * @param request
     * @return banner信息 分页集合
     * */
    @Override
    public PageResponse<ScrmSysBanner> page(ScrmSysBannerRequest request)
    {
        LambdaQueryWrapper<ScrmSysBanner> query = new LambdaQueryWrapper<ScrmSysBanner>();
        return Pageable.of(request,(()->  scrmSysBannerRepository.selectList(query)));
    }
    /**
     * 保存banner信息
     *
     * @param id banner信息ID
     * @return banner信息
     */
    @Override
    public boolean saveOrUpdate(ScrmSysBanner request) {
        return save(request);
    }

    /**
     * 查询banner信息
     *
     * @param id banner信息ID
     * @return banner信息
     */
    @Override
    public ScrmSysBanner selectScrmSysBannerById(Long id)
    {
        return scrmSysBannerRepository.selectById(id);
    }

}
